package com.mashibing.test.singleton;

/**
 * @author: mayu
 * @date: 2021年05月18日 16:36
 * 静态内部类方式
 */
public class S6 {
    private static class S6Holder {
        private static final S6 INSTANCE = new S6();
    }

    private S6() {
    }

    public static S6 getInstance() {
        return S6Holder.INSTANCE;
    }

    public static void main(String[] args) {
        for (int i = 0; i < 1000; i++) {
            new Thread(() -> {
                System.out.println(Thread.currentThread().getName() + "：" + S6.getInstance().hashCode());
            }).start();
        }
    }
}
